<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>
	<blockquote class="layui-elem-quote"><{$action}></blockquote>

	<fieldset class="layui-elem-field">
  		<legend>按条件搜索</legend>
  		<div class="layui-field-box">
			<form class="layui-form layui-form-pane1" method="post" action="<{$current_url}>">
				<{assign var="pid" value=$conditions['pid']|default:"all"}>
				<div class="layui-form-item">
					
					<div class="layui-input-inline">
						<select name="cate_id" class="abc" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
							<option value="">课程分类</option>
							<{foreach from=$cate item=item}>

								<option value="<{$item.id}>" <{if $course['cate_id']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
							<{/foreach}>
						</select>
					</div>
					<div class="layui-inline">
                        <select name="category[kemu]" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
                            <option value="">请选择科目</option>
                             <{foreach from=$subject item=item}>
                                <option value="<{$item.id}>" <{if $data['kemu']|default:"" eq $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                            <{/foreach}>
                        </select>
                    </div>

				  	<div class="layui-inline">
				  		<input type="text" name="category[search]" placeholder="搜索内容" value="<{if $data['search']}><{$data['search']}><{/if}>" class="layui-input">
			  		</div>

			    	<div class="layui-inline">
			    		<button type="submit" class="layui-btn">搜索</button>
			    		<a class="layui-btn" href="/video/upload"><i class="layui-icon"></i> 添加视频</a>
			    	</div>
		    	</div>
			</form>
  		</div>
	</fieldset>
			
	<form class="layui-form layui-form-pane1" method="post" action="/video/update_sorts" delete_action="/video/delete">
		<table class="layui-table" lay-even lay-skin="row">
		  	<thead>
			  	<tr>
				  	<th>ID</th>
				  	<th>视频标题</th>
				  	<th>上传用户</th>
					<th>所属分类</th>
					<th>视频时长</th>
					<th>点击量
						<{if $data['sort'] eq 2 and $data['asc_des'] eq 1}>
						<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/2/2//<{$data['search']}>/<{$is_all}>/<{$data['limit']}>"><span title="升序" class="icon icon-green icon-arrowthick-n"></span></a>
						<{else}>
						<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/2/1/<{$data['search']}>/<{$is_all}>/<{$data['limit']}>"><span title="降序" class="icon icon-green icon-arrowthick-s"></span></a>
						<{/if}>
					</th>
				  	<th>添加日期
				  		<{if $data['sort'] eq 4 and $data['asc_des'] eq 1}>
				  		<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/4/2/<{$data['search']}>/<{$is_all}>/<{$data['limit']}>"><span title="升序" class="icon icon-green icon-arrowthick-n"></span></a>
				  		<{else}>
						<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/4/1/<{$data['search']}>/<{$is_all}>/<{$data['limit']}>"><span title="降序" class="icon icon-green icon-arrowthick-s"></span></a>
						<{/if}>
				  	</th>
				  	<th>显示隐藏 
				  		<{if $data['sort'] eq 5 and $data['asc_des'] eq 1}>
				  		<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/5/2/<{$data['search']}>/<{$is_all}>/<{$data['limit']}>"><span title="升序" class="icon icon-green icon-arrowthick-n"></span></a>
				  		<{else}>
				  		<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/5/1/<{$data['search']}>/<{$is_all}>/<{$data['limit']}>"><span title="降序" class="icon icon-green icon-arrowthick-s"></span></a>
				  		<{/if}>
				  	</th>
				  	<th>排序
				  		<{if $data['sort'] eq 6 and $data['asc_des'] eq 1}>
				  		<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/6/2/<{$data['search']}>/<{$is_all}>/<{$data['limit']}>"><span title="升序" class="icon icon-green icon-arrowthick-n"></span></a>
				  		<{else}>
						<a href ="<{base_url()}>video/index/<{$data['review']}>/<{$data['activity_id']}>/6/1/<{$data['search']}>/<{$is_all}>/<{$data['limit']}>" ><span title="降序" class="icon icon-green icon-arrowthick-s"></span></a>
						<{/if}>
				  	</th>
				  	<th>操作</th>
			  	</tr>
		  	</thead>   
		  	<tbody>
		  	<{foreach from=$video item=item}>
			  	<tr>
			  		<td class="center" <{if $item.review == 1}>style="background-color:yellow"<{else if $item.review == 2}>style="background-color:red"<{/if}>>
						<input type="checkbox" name="ids[]" value="<{$item['id']}>" title="<{$item['id']}>">
					</td>
			  		<td class="center">
					<{if $is_all == 1}>
						<a href="<{$wap_url}>/video/detail/<{$item.id}>" target="_blank"><{$item['title']}></a>
					<{else}>
						<{$item['title']}>
					<{/if}>
					</td>
			  		<td class="center">
					<{if $is_all == 1}>
						<a href="/video/index/<{$data['review']}>/0/0/<{$item['uid']}>uidarry/0"><{$item['nick']}></a>
					<{else}>
						<{$item['nick']}>
					<{/if}>
					
					</td>
					<td class="center">
						<{foreach from=$cate item=item_cate}>
								<{if $item['cate_id']|default:"" eq $item_cate.id}><{$item_cate.name}><{/if}>
						<{/foreach}>
					</td>
			  		<td class="center"><{$item['duration']}></td>
			  		<td class="center"><{$item['click_num']}></td>
			  		<td class="center"><{$item['add_time']|date_format:'%Y-%m-%d <br> %H:%M:%S'}></td>
			  		<td class="center">
			  			<{if $item['status'] == 1}>
						<a video_id="<{$item['id']}>" status="0" class="activity_status" href="javascript:;">显示</a>
						<{else}>
						<a video_id="<{$item['id']}>" status="1" class="activity_status" href="javascript:;">隐藏</a>
						<{/if}>
			  		</td>
			  		<td class="center"><input style="width:40px;" name="sort[<{$item['id']}>]" maxlength="4" type="text" value="<{$item['sort']}>" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" /></td>
			  		<td class="center">
						<a class="btn btn-success" target="_blank" href="/video/view/<{$item['id']}>">
							<i class="icon-zoom-in icon-white"></i>  
							查看                                           
						</a>
						<a class="layui-btn layui-btn-primary layui-btn-small" href="/video/edit/<{$item['id']}>" target="_blank"><i class="layui-icon"></i></a>
						<a class="layui-btn layui-btn-primary layui-btn-small delete_data" href="/video/delete/<{$item['id']}>"><i class="layui-icon"></i></a>
					</td>
			  	</tr>
		  	<{/foreach}>
		  	<{if $video|count eq 0}>
		  		<tr>
			  		<td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
						赞无数据！
					</td>
			  	</tr>
		  	<{/if}>
		  	<tr>
				<td class="center" colspan="12">
					<input type="checkbox" lay-filter="checkbox_all" title="全选">
					<button id="delete" class="layui-btn layui-btn-primary layui-btn-small" style="margin-top:4px;"><i class="layui-icon"></i> 批量删除</button>
				</td>
			</tr>
	  		</tbody>
	  	</table>
  	</form>
  	<div class="layui-box layui-laypage layui-laypage-default">
			<{$pagination}>
		</div>
<{include file="public_html/footer.html"}>
<script>
    $(function() {
        layui.use(['form','layedit','jquery'], function() {
            var form = layui.form();
            var layedit = layui.layedit;
            $ = layui.jquery;
            form.on('select(cate_id)', function(data){
                var ii = layer.load();
                var id = data.value;
                $("#course_id").html('<option value="">请选择科目</option>');
                form.render('select');
                $.ajax({
                    type: "POST",
                    url: "/course/get_cate_subject",
                    data: {id:id},
                    dataType: "json",
                    success: function (data) {
                        var ddl = $("#subject");
                        var html ='<option value="">请选择科目</option>';
                        $(data).each(function (key) {
                            html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
                        });
                        $("#subject").html(html);
                        form.render('select');
                        layer.close(ii);
                    }
                });
            });  
        });


    })
    
</script>